package tt.dz.appserver.mvc.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import tt.dz.appserver.entity.model.ResultMappingEntity;
import tt.dz.appserver.service.business.InformationService;
import tt.dz.appserver.util.Result;
import tt.dz.appserver.util.enums.Response;

/**
 * 资讯控制器
 * @author xielf
 *
 */
@RestController
@RequestMapping("/info")
public class InfomationController {

	/**资讯信息*/
	@Resource
	private InformationService infomationService;
	
	/**
	 * 资讯列表
	 * @param pageNo
	 */
	@RequestMapping(value="/infoList",produces={"application/json;charset=utf-8"},method=RequestMethod.GET)
	public String infoList(@RequestParam(defaultValue="1") Integer pageNo){
		
		ResultMappingEntity resultMappingEntity = null;
		
		try {
			resultMappingEntity = infomationService.getInfomationList(pageNo);	
		} catch (Exception e) {
			e.printStackTrace();
			resultMappingEntity = Result.responseBody(Response.RUNTIME_ERROR.getCode(), Response.RUNTIME_ERROR.getMsg(), e.getMessage());
		}
		return resultMappingEntity.toString();
	}
}
